# coding: utf-8
""" 指定ndarray数组元素的类型
"""
import numpy as np

x = np.array([1, 2.6, 3], dtype=np.int64)
print("生成指定元素类型的数组, 设置dtype属性", x)
print("打印x.dtype ->", x.dtype)
print("-"*20, "\n")

y = x.astype(np.float64)
print("使用astype, 复制数组并转换类型", y)
print("打印y.dtype ->", y.dtype)
print("-"*20, "\n")